﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="RoomList.aspx.cs"
    Inherits="RoomList" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title>来话宝 <%=FTchina.Library.MasterHelper.ClientTitle %>-房 间 管 理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="/images/style.css" rel="Stylesheet" />
    <script language="javascript" type="text/javascript" src="/js/jiazai.js"></script>
    <script src="/js/introbox.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
    <script language="javascript" type="text/javascript" src="/js/jquery-easyui/jquery.easyui.min.js"></script>
    <script language="javascript" type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" type="text/javascript" src="/js/pagefunction.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#checkall").click(

        function () {

            if (this.checked) {
                $("input[name='ids']").each(function () { this.checked = true; });
            } else {
                $("input[name='ids']").each(function () { this.checked = false; });
            }
        });
        });

        function jqchkall(op) {  //jquery获取复选框值 

            var chk_value = [];
            $('input[name="ids"]:checked').each(function () {
                chk_value.push($(this).val());

            });
            //var op = encodeURIComponent($("#dplop").val());
            if (chk_value.length > 0) {
                window.location.href = 'preset.aspx?ids=' + chk_value + '&op=' + op + '&type=room&back=RoomList.aspx' + location.search;
            }
            else {
                alert("请至少选择一项");
            }
        }
        ///单个操作清空
        function singlefree(op, ids) {

            window.location.href = 'preset.aspx?ids=' + ids + '&op=' + op + '&type=room&back=RoomList.aspx' + location.search;
        }
        ///单个到店入住
        function jqchk(op, ids, order) {
            window.location.href = 'preset.aspx?ids=' + ids + '&op=' + op + '&type=order&back=RoomList.aspx' + location.search;
        } 
    </script>
</head>
<body style="overflow-x: hidden">
    <form id="form1" runat="server">
    <div>
        <table width="100%" class="tableBorder" border='1' cellspacing="0" style="border-collapse: collapse;"
            bgcolor="#ffffff" bordercolor="#cccccc">
            <tr align="center" valign="middle">
                <th height="22" colspan="88">
                    房 间 管 理
                </th>
            </tr>
            <tr>
                <td>
                    操作
                </td>
                <td>
                    <input type="button" class="btn" value="刷新" onclick="Refresh()" />
                    <asp:Button runat="server" ID="btnexcel" Text="导出Excel" OnClick="btnexcel_Click"
                        CssClass="btn" />
                    <input type="button" class="btn" value="添加" onclick="Go('?act=add')" />
                    &nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;查看
                    <asp:Button runat="server" ID="btnFree" Text="空闲房间" OnClick="btnFree_Click" class="btn" />
                    <asp:Button runat="server" ID="btnWork" Text="已入住房间" OnClick="btnWork_Click" class="btn" />
                    <asp:Button runat="server" ID="btnAll" Text="所有房间" OnClick="btnAll_Click" class="btn" />
                    &nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;操作
                    <input type='checkbox' id='checkall' name='checkall' />全选/取消
                    <input class="btn" type="button" onclick="{if(confirm('请确认操作?')){jqchkall('RoomList');}return false;}"
                        value="清空状态" />
                </td>
            </tr>
            <asp:Panel runat="server" ID="plop">
                <tr style='display: none'>
                    <td>
                        id
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbid"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        房间名称
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbroomName"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        容纳人数
                    </td>
                    <td>
                        <asp:TextBox runat="server" class="easyui-numberbox" ID="txbpcount"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        state
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbstate"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        stateDate
                    </td>
                    <td>
                        <asp:TextBox runat="server" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                            ID="txbstateDate"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        customerID
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerID"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Button runat="server" CssClass="btn" ID="btnRoomListOk" Text="确定" OnClick="btnRoomListOk_Click" />
                    </td>
                </tr>
            </asp:Panel>
        </table>
        <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <asp:GridView ID="gvList" runat="server" AllowPaging="false" CellPadding="2" AutoGenerateColumns="False"
                        GridLines="Both" EmptyDataText="当前页无数据" CssClass="tableBorder" Width="100%" EnableViewState="false">
                        <Columns>
                            <asp:TemplateField HeaderText="序号">
                                <ItemTemplate>
                                    <input type='checkbox' id='ids' name='ids' value='<%# Eval("Id") %>' /><%# Eval("Id") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="roomName" HeaderText="房间名称" />
                            <asp:BoundField DataField="pcount" HeaderText="容纳人数" />
                            <asp:TemplateField HeaderText="状态">
                                <ItemTemplate>
                                    <%#(Eval("state").ToString() == "0") ? "<font color=green><b>空闲</b></font>" : "<font color=orange><b>占用</b></font>"%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="客户">
                                <ItemTemplate>
                                    <%#FTchina.SMS.CustomerInfo.GetCustomerNameByID(Eval("Customerid").ToString())%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="时间">
                                <ItemTemplate>
                                    <%#FTchina.basic.getDisplayDate(Eval("stateDate").ToString()).Replace(DateTime.Now.Date.ToString("yyyy-M-d"), "")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="操作">
                                <ItemTemplate>
                                    <%#(Eval("state").ToString()=="0")?
                                      "<input class=\"btn\" style=' color=orange; color=green;font-weight:bold' type=\"button\" onclick=\"{if(confirm('请确认操作?')){jqchk('RoomList','"+Eval("id")+"','order');}return false;}\"  value=\"到店入住\" />"
                                     :
                                                                               "<input class=\"btn\" style=' color=orange; color=orange;font-weight:bold' type=\"button\" onclick=\"{if(confirm('请确认操作?')){singlefree('RoomList','" + Eval("id") + "');}return false;}\"  value=\"清空状态\" />"
                                    %>
                                    <input class="btn" type="button" onclick="Go('?act=mod&id=<%#Eval("id") %>')" value="修改" />
                                    <input class="btn" type="button" onclick="javascript:if (confirm('您真的确定要删除吗？\n\n请确认！')==true){Go('?act=del&id=<%#Eval("id")%>')}else{return false}"
                                        value="删除" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <PagerSettings Visible="False" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <asp:Literal runat="server" ID="litpager"></asp:Literal>
    </div>
    </form>
    <script language='javascript' type='text/javascript' src='/JS/tablecolor.js'></script>
    <script type='text/javascript' language='javascript'><!--
        TableColor('gvList', '#F1F8FE', '#FFFFFF', '#F8DC87', '#BCE774');
    --></script>
</body>
</html>
